﻿using System.Web.Mvc;
using SilenthinkCommon.Extension;

namespace Web.Areas.Item
{
    public class ItemAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "Item";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.Routes.MapSubDomainRoute(
                "Js", AreaName.ToLower(), // SubDomain
                "{param}.js", // Url
                new {controller = "Home", action = "Js", param = UrlParameter.Optional}, // Defaults
                new[] {"Web.Areas.Item.Controllers"}); // Namespace
            context.Routes.MapSubDomainRoute(
                "Item", AreaName.ToLower(), // SubDomain
                "{param}.html", // Url
                new {controller = "Home", action = "Index", param = UrlParameter.Optional}, // Defaults
                new[] {"Web.Areas.Item.Controllers"}); // Namespace

            context.Routes.MapSubDomainRoute(
                "ItemDefault", AreaName.ToLower(), // SubDomain
                "{controller}/{action}/param", // Url
                new {controller = "Home", action = "Index", param = UrlParameter.Optional}, // Defaults
                new[] { "Web.Areas.Item.Controllers" }); // Namespace

        }
    }
}
